pfn_batch = calloc(MAX_BATCH_SIZE, sizeof(unsigned long));
if ((pfn_type == NULL) || (pfn_batch == NULL)) {
+ ERR("failed to alloc memory for pfn_type and/or pfn_batch arays.");
errno = ENOMEM;
goto out;
}
for (i = 0; i < max_pfn; i++) {
mfn = live_p2m[i];
- if((live_m2p[mfn] != i) && (mfn != 0xffffffffUL)) {
+ if((mfn != 0xffffffffUL) && (live_m2p[mfn] != i)) {
DPRINTF("i=0x%x mfn=%lx live_m2p=%lx\n", i,
mfn, live_m2p[mfn]);
err++;
unless its sent sooner anyhow */
set_bit(n, to_fix);
- if(iter > 1)
+ if( (iter > 1) && IS_REAL_PFN(n) )
DPRINTF("netbuf race: iter %d, pfn %x. mfn %lx\n",
iter, n, pfn_type[batch]);
continue;
out:
+ if (live) {
+ if(xc_shadow_control(xc_handle, dom, DOM0_SHADOW_CONTROL_OP_OFF,
+ NULL, 0, NULL ) < 0) {
+ DPRINTF("Warning - couldn't disable shadow mode");
+ }
+ }
+
if (live_shinfo)
munmap(live_shinfo, PAGE_SIZE);
/* Number of entries in the pfn_to_mfn_frame_list_list */
#define P2M_FLL_ENTRIES (((max_pfn)+(ulpp*ulpp)-1)/(ulpp*ulpp))
+/* Current guests allow 8MB 'slack' in their P2M */
+#define NR_SLACK_ENTRIES ((8 * 1024 * 1024) / PAGE_SIZE)
+
+/* Is the given PFN within the 'slack' region at the top of the P2M? */
+#define IS_REAL_PFN(_pfn) ((max_pfn - (_pfn)) > NR_SLACK_ENTRIES)
+
/* Returns TRUE if the PFN is currently mapped */
#define is_mapped(pfn_type) (!((pfn_type) & 0x80000000UL))
struct vcpu *v;
int new_modes = (mode & ~d->arch.shadow_mode);
- // Gotta be adding something to call this function.
- ASSERT(new_modes);
-
+ if(!new_modes) /* Nothing to do - return success */
+ return 0;
+
// can't take anything away by calling this function.
ASSERT(!(d->arch.shadow_mode & ~mode));